package com.amazon.inapp.purchasing;

import android.os.RemoteException;
import com.amazon.android.framework.exception.KiwiException;
import com.amazon.venezia.command.SuccessResult;
import java.util.Map;

final class KiwiGetUserIdCommandTask extends KiwiBaseCommandTask
{
  private static final String COMMAND_NAME = "get_userId";
  private static final String COMMAND_VERSION = "1.0";
  private static final String TAG = "KiwiGetUserIdCommandTask";

  KiwiGetUserIdCommandTask(String paramString)
  {
    super("get_userId", "1.0", paramString);
  }

  private void notifyObserver(final GetUserIdResponse paramGetUserIdResponse)
  {
    postRunnableToMainLooper(new Runnable()
    {
      public void run()
      {
        PurchasingObserver localPurchasingObserver = PurchasingManager.getPurchasingObserver();
        if (localPurchasingObserver != null)
        {
          if (Logger.isTraceOn())
            Logger.trace("KiwiGetUserIdCommandTask", "Invoking onGetUserIdResponse with " + paramGetUserIdResponse);
          localPurchasingObserver.onGetUserIdResponse(paramGetUserIdResponse);
        }
      }
    });
  }

  protected void onSuccess(SuccessResult paramSuccessResult)
    throws RemoteException, KiwiException
  {
    if (Logger.isTraceOn())
      Logger.trace("KiwiGetUserIdCommandTask", "onSuccess");
    Map localMap = paramSuccessResult.getData();
    if (Logger.isTraceOn())
      Logger.trace("KiwiGetUserIdCommandTask", "data: " + localMap);
    String str1 = (String)localMap.get("userId");
    String str2;
    GetUserIdResponse.GetUserIdRequestStatus localGetUserIdRequestStatus1;
    if (!isNullOrEmpty(str1))
    {
      GetUserIdResponse.GetUserIdRequestStatus localGetUserIdRequestStatus2 = GetUserIdResponse.GetUserIdRequestStatus.SUCCESSFUL;
      str2 = str1;
      localGetUserIdRequestStatus1 = localGetUserIdRequestStatus2;
    }
    while (true)
    {
      notifyObserver(new GetUserIdResponse(getRequestId(), localGetUserIdRequestStatus1, str2));
      return;
      if (Logger.isTraceOn())
        Logger.trace("KiwiGetUserIdCommandTask", "found null or empty user ID");
      localGetUserIdRequestStatus1 = GetUserIdResponse.GetUserIdRequestStatus.FAILED;
      str2 = null;
    }
  }

  protected void sendFailedResponse()
  {
    notifyObserver(new GetUserIdResponse(getRequestId(), GetUserIdResponse.GetUserIdRequestStatus.FAILED, null));
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.amazon.inapp.purchasing.KiwiGetUserIdCommandTask
 * JD-Core Version:    0.6.2
 */